#!/usr/bin/python
# -*- coding: utf-8 -*-

import sqlapi
import GlobalVariable
import jdcapi
import time


GlobalVariable.headers["wskey"] = GlobalVariable.tgt
GlobalVariable.service_headers["tgt"] = GlobalVariable.tgt

for feed_id in sqlapi.find_name():
    # 公网ip，   上传，   cpu，mac，固件版本，wan口ip，？，  下载速度， 内存，运行模式，   在线时间，   运行模式， ap模式， sn
    public_ip, upload, cpu, mac, rom, wanip, romType, download, mem, model_name, onlineTime, model, ap_mode, sn = jdcapi.getControlDevice(
        feed_id, 2)
    data_list = [mac, int(time.time() / 60) * 60, round(int(upload) / 10), round(int(download) / 10), int(float(cpu)), int(float(mem))]
    # sqlapi.in_sampling(data_list)
    print(data_list)
